package com.wonders.frame.repository;

import com.wonders.frame.entity.AuthSta;
import com.wonders.frame.repository.core.CoreRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author:admin
 * @Create:2019-05-14
 */
@Repository
public interface AuthStaRepository extends CoreRepository<AuthSta> {
    @Query(nativeQuery = true, value = "select * from auth_sta where type='auth_orga' order by sta_date desc limit 0,1")
    AuthSta findAuthOrga();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='equipment_member' order by sta_date desc limit 0,1")
    AuthSta findEquipmentMember();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='job_order' order by sta_date desc limit 0,1")
    AuthSta findJobOrder();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='job_type'")
    List<AuthSta> findJobType();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='work_area'")
    AuthSta findWorkArea();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='unmannedflight_count'")
    AuthSta findUfCount();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='unmannedflight'")
    List<AuthSta> findUf();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='member'")
    List<AuthSta> findMember();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='job_top' order by zd1")
    List<AuthSta> findJobTop();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='top10' order by zd1")
    List<AuthSta> findJobTop10();

    @Query(nativeQuery = true, value = "select * from auth_sta where type ='area_unmannedflight'")
    AuthSta findAreaUf();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='area_job'")
    AuthSta findAreaJob();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='area_count'")
    AuthSta findAreaCount();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='area_top10' order by zd1")
    List<AuthSta> findAreaJobTop10();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='area_job_type' ")
    List<AuthSta> findAreaJobType();

    @Query(nativeQuery = true, value = "select * from auth_sta where type ='jobAnalysis_mile_count'")
    AuthSta findMileCount();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='jobAnalysis_mile_avg'")
    AuthSta findMileAvg();

    @Query(nativeQuery = true, value = "select * from auth_sta where type ='jobAnalysis_job_count' ")
    List<AuthSta> findJobCount();
    @Query(nativeQuery = true, value = "select * from auth_sta where type ='jobAnalysis_job_area' ")
    List<AuthSta> findJobArea();

    @Query(nativeQuery = true, value = "select * from auth_sta where type ='jobAnalysis_month' order by zd1 ")
    List<AuthSta> findAnalysisMonth();
}
